import logging
import config


class OpenAccountApi:
    def __init__(self, session):
        self.session = session

    # 实名认证接口
    def realname(self, user_realname, card_id):
        url = config.BASE_HOST + "/member/realname/approverealname"
        info = {
            "realname": user_realname,
            "card_id": card_id
        }
        resp = self.session.post(url=url, data=info, files={"x": "y"})
        logging.info(f"实名认证接口返回值：{resp.json()}")
        return resp

    # 开户接口
    def open_account(self):
        url = config.BASE_HOST + "/trust/trust/register"
        resp = self.session.post(url=url)
        logging.info(f"开户接口返回值：{resp.json()}")
        return resp

    # 第三方开户接口
    def third_open_account(self, url, from_action):
        resp = self.session.post(url=url, data=from_action)
        logging.info(f"第三方开户接口返回值：{resp.text}")
        return resp
